class Solution(object):
    def kthPalindrome(self, queries, intLength):
        ans = []
        if intLength % 2 == 0:
            base_len = intLength // 2
            base = 10 ** (base_len - 1)
            max_base = 10 ** base_len
            for k in queries:
                if base + k - 1 < max_base:
                    num = base + k - 1
                    ans.append(int(str(num) + str(num)[::-1]))
                else:
                    ans.append(-1)
        else:
            base_len = (intLength + 1)// 2
            base = 10 ** (base_len - 1)
            max_base = 10 ** base_len
            for k in queries:
                if base + k - 1 < max_base:
                    num = base + k - 1
                    ans.append(int(str(num) + str(num)[:-1][::-1]))
                else:
                    ans.append(-1)
        return ans